//
//  JobDescribeTableViewCell.m
//  XRSquare
//
//  Created by 穆相臣 on 2018/8/31.
//  Copyright © 2018年 UaenaMo. All rights reserved.
//

#import "JobDescribeTableViewCell.h"

@interface JobDescribeTableViewCell ()
{
    UILabel * titleLabel;
    UILabel * contentLabel;
    UIView * line;
}
@end
    

@implementation JobDescribeTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, ScreenWidth, 20)];
        titleLabel.font = [UIFont systemFontOfSize:15];
        titleLabel.text = @"说明";
        [self addSubview:titleLabel];
        
        contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 40, ScreenWidth - 20, 20)];
        contentLabel.font = [UIFont systemFontOfSize:15];
        contentLabel.numberOfLines = 0;
        contentLabel.textColor = [UIColor colorFromHexCode:@"b3b3b3"];
        [self addSubview:contentLabel];
        
        line = [[UIView alloc]initWithFrame:CGRectMake(0, 39, ScreenWidth, 1)];
        line.backgroundColor = [UIColor colorFromHexCode:@"f3f3f3"];
        [self addSubview:line];
    }
    return self;
}

+(CGFloat)heightWithData:(NSString *)data
{
    UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth - 20, 20)];
    label.font = [UIFont systemFontOfSize:15];
    label.numberOfLines = 0;
    [label sizeToFit];
    return label.frame.size.height + 40 + 10;
}

-(void)loadData:(NSString *)data
{
    contentLabel.frame = CGRectMake(10, 40, ScreenWidth - 20, 20);
    contentLabel.text = data;
    [contentLabel sizeToFit];
    
    line.frame = CGRectMake(0, contentLabel.frame.size.height + 40 + 9, ScreenWidth, 1);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
